import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
driver = webdriver.Edge()
driver.get("http://121.43.169.97:8848/pageA.html")
driver.maximize_window()
time.sleep(1)
select = Select(driver.find_element(By.XPATH,"/html/body/div/fieldset/form/p[6]/select"))
# 根据索引实现单项选择框选择
select.select_by_index(2)
time.sleep(2)
# 根据value属性实现单项选择框选择
select.select_by_value("sh")
time.sleep(2)
# 根据文本属性实现单项选择框选择
select.select_by_visible_text("北京")
time.sleep(2)
driver.quit()